/*
 * CalendarServices.java
 * 
 * Created by demory on Aug 21, 2009, 9:37:40 PM
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.fpdev.core.transit;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author demory
 */
public class CalendarServices {

  private Map<String, CalendarService> services_;

  public CalendarServices() {
    services_ = new HashMap<String, CalendarService>();
  }

  public void addService(CalendarService service) {
    services_.put(service.getID(), service);
  }

  public CalendarService getService(String serviceID) {
    return services_.get(serviceID);
  }

  public Collection<CalendarService> getServices() {
    return services_.values();
  }

  public CalendarService resolveDate(Date date) {
    for(CalendarService service : getServices())
      if(service.isDateServed(date)) return service;
    return null;
  }
}
